Skip to left side bar
>
  • File
  • Edit
  • View
  • Run
  • Kernel
  • Tabs
  • Settings
  • Help

Open Tabs

  • 08-visualization-plotly.ipynb

Kernels

  • 17-ts-core.ipynb
  • 031-data-wrangling-with-mongodb.ipynb
  • 04-pandas-advanced.ipynb
  • 18-ts-models.ipynb
  • 11-databases-mongodb.ipynb
  • 10-databases-sql.ipynb
  • 033-autoregressive-models.ipynb
  • 035-assignment.ipynb
  • 032-linear-regression-with-time-series-data.ipynb
  • 034-arma-models-and-hyperparameter-tuning.ipynb
  • 01-python-getting-started.2022-12-23T07-21-48-609Z.ipynb
  • 02-python-advanced.ipynb
  • 03-pandas-getting-started.2022-12-23T07-21-48-609Z.ipynb
  • 04-pandas-advanced.2022-12-23T07-21-48-609Z.ipynb
  • 05-pandas-summary-statistics.2022-12-23T07-21-48-609Z.ipynb
  • 06-visualization-matplotlib.2022-12-23T07-21-48-609Z.ipynb
  • 07-visualization-pandas.ipynb
  • 08-visualization-plotly.ipynb

Terminals

    //ds-curriculum/@textbook/
    Name
    ...
    Last Modified
    • .ipynb_checkpointsan hour ago
    • data2 months ago
    • 01-python-getting-started.2022-12-23T07-21-48-609Z.ipynban hour ago
    • 01-python-getting-started.ipynb2 months ago
    • 02-python-advanced.ipynban hour ago
    • 03-pandas-getting-started.2022-12-23T07-21-48-609Z.ipynb2 months ago
    • 03-pandas-getting-started.ipynb2 months ago
    • 04-pandas-advanced.2022-12-23T07-21-48-609Z.ipynban hour ago
    • 04-pandas-advanced.ipynb2 months ago
    • 05-pandas-summary-statistics.2022-12-23T07-21-48-609Z.ipynban hour ago
    • 05-pandas-summary-statistics.ipynb2 months ago
    • 06-visualization-matplotlib.2022-12-23T07-21-48-609Z.ipynb30 minutes ago
    • 06-visualization-matplotlib.ipynb2 months ago
    • 07-visualization-pandas.ipynb5 minutes ago
    • 08-visualization-plotly.ipynba month ago
    • 09-visualization-seaborn.ipynba month ago
    • 10-databases-sql.ipynb2 months ago
    • 11-databases-mongodb.ipynb19 days ago
    • 12-ml-core.ipynb2 months ago
    • 13-ml-data-pre-processing-and-production.ipynba month ago
    • 14-ml-classification.ipynb2 months ago
    • 15-ml-regression.ipynba month ago
    • 16-ml-unsupervised-learning.ipynb2 months ago
    • 17-ts-core.ipynb2 months ago
    • 18-ts-models.ipynb2 months ago
    • 19-linux-command-line.ipynb2 months ago
    • 20-statistics.ipynb2 months ago
    • 21-python-object-oriented-programming.ipynb2 months ago
    • 22-apis.ipynb2 months ago
    • main.py3 months ago
    • 08-visualization-plotly.ipynb
    xxxxxxxxxx
    ​

    Usage Guidelines

    This lesson is part of the DS Lab core curriculum. For that reason, this notebook can only be used on your WQU virtual machine.

    This means:

    • ⓧ No downloading this notebook.
    • ⓧ No re-sharing of this notebook with friends or colleagues.
    • ⓧ No downloading the embedded videos in this notebook.
    • ⓧ No re-sharing embedded videos with friends or colleagues.
    • ⓧ No adding this notebook to public or private repositories.
    • ⓧ No uploading this notebook (or screenshots of it) to other websites, including websites for study resources.

    xxxxxxxxxx
    <font size="+3"><strong>Visualizing Data: plotly express</strong></font>

    Visualizing Data: plotly express

    xxxxxxxxxx
    There are many ways to interact with data, and one of the most powerful modes of interaction is through **visualizations**. Visualizations show data graphically, and are useful for exploring, analyzing, and presenting datasets. We use four libraries for making visualizations: [pandas](../%40textbook/07-visualization-pandas.ipynb), [Matplotlib](../%40textbook/06-visualization-matplotlib.ipynb), plotly express, and [seaborn](../%40textbook/09-visualization-seaborn.ipynb). In this section, we'll focus on using plotly express.

    There are many ways to interact with data, and one of the most powerful modes of interaction is through visualizations. Visualizations show data graphically, and are useful for exploring, analyzing, and presenting datasets. We use four libraries for making visualizations: pandas, Matplotlib, plotly express, and seaborn. In this section, we'll focus on using plotly express.

    xxxxxxxxxx
    # Scatter Plots

    Scatter Plots¶

    xxxxxxxxxx
    A **scatter plot** is a graph that uses dots to represent values for two different numeric variables. The position of each dot on the horizontal and vertical axis indicates values for an individual data point. Scatter plots are used to observe relationships between variables, and are especially useful if you're looking for **correlations**.

    A scatter plot is a graph that uses dots to represent values for two different numeric variables. The position of each dot on the horizontal and vertical axis indicates values for an individual data point. Scatter plots are used to observe relationships between variables, and are especially useful if you're looking for correlations.

    [1]:
     
    import pandas as pd
    ​
    mexico_city1 = pd.read_csv("./data/mexico-city-real-estate-1.csv")
    ​
    # clean the data and drop `NaNs`
    mexico_city1 = mexico_city1.drop(
        ["floor", "price_usd_per_m2", "expenses", "rooms"], axis=1
    )
    mexico_city1 = mexico_city1.dropna(axis=0)
    mexico_city1.head()
    [1]:
    operation property_type place_with_parent_names lat-lon price currency price_aprox_local_currency price_aprox_usd surface_total_in_m2 surface_covered_in_m2 price_per_m2 properati_url
    2 sell apartment |México|Distrito Federal|Cuauhtémoc| 19.41501,-99.175174 2700000.0 MXN 2748947.10 146154.51 61.0 61.0 44262.295082 http://cuauhtemoc.properati.com.mx/2pu_venta_a...
    3 sell apartment |México|Distrito Federal|Cuauhtémoc| 19.41501,-99.175174 6347000.0 MXN 6462061.92 343571.36 176.0 128.0 49585.937500 http://cuauhtemoc.properati.com.mx/2pv_venta_a...
    6 sell apartment |México|Distrito Federal|Miguel Hidalgo| 19.456564,-99.191724 670000.0 MXN 682146.11 36267.97 65.0 65.0 10307.692308 http://miguel-hidalgo-df.properati.com.mx/46h_...
    7 sell apartment |México|Distrito Federal|Gustavo A. Madero| 19.512787,-99.141393 1400000.0 MXN 1425379.97 75783.82 82.0 70.0 20000.000000 http://gustavo-a-madero.properati.com.mx/46p_v...
    8 sell house |México|Distrito Federal|Álvaro Obregón| 19.358776,-99.213557 6680000.0 MXN 6801098.67 361597.08 346.0 346.0 19306.358382 http://alvaro-obregon.properati.com.mx/46t_ven...
    xxxxxxxxxx
    After cleaning the data, we can use plotly express to draw scatter plots by specifying the DataFrame and the interested column names.

    After cleaning the data, we can use plotly express to draw scatter plots by specifying the DataFrame and the interested column names.

    [2]:
     
    import plotly.express as px
    ​
    fig = px.scatter(mexico_city1, x="price", y="surface_covered_in_m2")
    fig.show()
    020M40M60M80M100M120M02000400060008000
    pricesurface_covered_in_m2
    plotly-logomark
    xxxxxxxxxx
    <font size="+1">Practice</font> 

    Practice

    Plot the scatter plot for column "price" and "surface_total_in_m2".

    [3]:
     
    fig = px.scatter(mexico_city1,x="price",y="surface_covered_in_m2")
    fig.show()
    020M40M60M80M100M120M02000400060008000
    pricesurface_covered_in_m2
    plotly-logomark
    xxxxxxxxxx
    # 3D Scatter Plots

    3D Scatter Plots¶

    Scatter plots can summarize information in a DataFrame. Three dimensional scatter plots look great, but be careful: it can be difficult for people who might not be sure what they're looking at to accurately determine values of points in the plot. Still, scatter plots are useful for displaying relationships between three quantities that would be more difficult to observe in a two dimensional plot.

    Let's take a look at the first 50 rows of the mexico-city-real-estate-1.csv dataset.

    [4]:
     
    import pandas as pd
    import plotly.express as px
    ​
    mexico_city1 = pd.read_csv("./data/mexico-city-real-estate-1.csv")
    mexico_city1 = mexico_city1.drop(
        ["floor", "price_usd_per_m2", "expenses", "rooms"], axis=1
    )
    mexico_city1 = mexico_city1.dropna(axis=0)
    mexico_city1[
        ["First Empty", "Country", "City", "Borough", "Second Empty"]
    ] = mexico_city1["place_with_parent_names"].str.split("|", 4, expand=True)
    mexico_city1 = mexico_city1.drop(["First Empty", "Second Empty"], axis=1)
    mexico_city1_subset = mexico_city1.loc[1:50]
    ​
    fig = px.scatter_3d(
        mexico_city1_subset,
        x="Borough",
        y="surface_covered_in_m2",
        z="price",
        symbol="property_type",
        color="property_type",
        labels={
            "surface_covered_in_m2": "Surface Covered in m^2",
            "price": "Price",
            "property_type": "Property Type",
        },
    )
    ​
    fig.show()
    /tmp/ipykernel_659/3122900234.py:11: FutureWarning:
    
    In a future version of pandas all arguments of StringMethods.split except for the argument 'pat' will be keyword-only.
    
    
    Property Typeapartmenthousestore
    plotly-logomark
    xxxxxxxxxx
    Notice that the plot is interactive: you can rotate it zoom in or out. These kinds of plots also makes outliers easier to find; here, we can see that houses have higher prices than other types of properties.

    Notice that the plot is interactive: you can rotate it zoom in or out. These kinds of plots also makes outliers easier to find; here, we can see that houses have higher prices than other types of properties.

    xxxxxxxxxx
    <font size="+1">Practice</font> 

    Practice

    Modify the DataFrame to include columns for the base 10 log of price and surface_covered_in_m2 and then plot these for the entire mexico-city-real-estate-1.csv dataset.

    [5]:
     
    import math
    ​
    ​
    xxxxxxxxxx
    # Mapbox Scatter Plots

    Mapbox Scatter Plots¶

    xxxxxxxxxx
    A **mapbox scatter plot** is a special kind of scatter plot that allows you to create scatter plots in two dimensions and then superimpose them on top of a map. Our `mexico-city-real-estate-1.csv` dataset is a good place to start, because it includes **location data**. After importing the dataset and removing rows with missing data, split the `lat-lon` column into two separate columns: one for `latitude` and the other for `longitude`. Then use these to make a mapbox plot. Unfortunately, at present this type of plot does not easily allow for marker shape to vary based on a column of the DataFrame.

    A mapbox scatter plot is a special kind of scatter plot that allows you to create scatter plots in two dimensions and then superimpose them on top of a map. Our mexico-city-real-estate-1.csv dataset is a good place to start, because it includes location data. After importing the dataset and removing rows with missing data, split the lat-lon column into two separate columns: one for latitude and the other for longitude. Then use these to make a mapbox plot. Unfortunately, at present this type of plot does not easily allow for marker shape to vary based on a column of the DataFrame.

    [6]:
     
    mexico_city1 = pd.read_csv("./data/mexico-city-real-estate-1.csv")
    mexico_city1 = mexico_city1.drop(
        ["floor", "price_usd_per_m2", "expenses", "rooms"], axis=1
    )
    mexico_city1 = mexico_city1.dropna(axis=0)
    mexico_city1[["latitude", "longitude"]] = mexico_city1["lat-lon"].str.split(
        ",", 2, expand=True
    )
    mexico_city1["latitude"] = mexico_city1["latitude"].astype(float)
    mexico_city1["longitude"] = mexico_city1["longitude"].astype(float)
    fig = px.scatter_mapbox(
        mexico_city1,
        lat="latitude",
        lon="longitude",
        color="property_type",
        mapbox_style="carto-positron",
        labels={"property_type": "Property Type"},
        title="Distribution of Property Types for Sale in Mexico City",
    )
    fig.show()
    /tmp/ipykernel_659/3692783844.py:6: FutureWarning:
    
    In a future version of pandas all arguments of StringMethods.split except for the argument 'pat' will be keyword-only.
    
    
    © Carto © OpenStreetMap contributors
    Property TypeapartmenthousestoreDistribution of Property Types for Sale in Mexico City
    plotly-logomark
    xxxxxxxxxx
    <font size="+1">Practice</font> 

    Practice

    Create another column in the DataFrame with a log scale of the prices. Then create three separate plots, one for stores, another for houses, and a final one for apartments. Color the points in the plots by the log of the price.

    [7]:
     
    from math import log10
    ​
    ​
    xxxxxxxxxx
    # Choropleth Maps

    Choropleth Maps¶

    xxxxxxxxxx
    A Choropleth Map is a map composed of colored polygons, showing the variable of interest at different color depth across geographies.Plotly express has a function called `px.choropleth` that be used to plot Choropleth Map. The challenges here are getting the geometry information. There are two ways, one is to use the built-in geometries in plotly when plot US States (use the state name directly) and world countries (use ISP-3 code). Another way is to look for GeoJSON files where each location has geometry information. In the following example, we will show the plot in US States with a synthetic data set.  

    A Choropleth Map is a map composed of colored polygons, showing the variable of interest at different color depth across geographies.Plotly express has a function called px.choropleth that be used to plot Choropleth Map. The challenges here are getting the geometry information. There are two ways, one is to use the built-in geometries in plotly when plot US States (use the state name directly) and world countries (use ISP-3 code). Another way is to look for GeoJSON files where each location has geometry information. In the following example, we will show the plot in US States with a synthetic data set.

    [8]:
    xxxxxxxxxx
     
    # Create Synthetic Dataset
    df = pd.DataFrame.from_dict(
        {"State": ["CA", "TX", "NY", "HI", "DE"], "Temparature": [100, 120, 110, 90, 105]}
    )
    df
    [8]:
    State Temparature
    0 CA 100
    1 TX 120
    2 NY 110
    3 HI 90
    4 DE 105
    [9]:
    xxxxxxxxxx
     
    # Plot the data set in US map
    fig = px.choropleth(
        df, locations="State", locationmode="USA-states", color="Temparature", scope="usa"
    )
    fig.show()
    90100110120Temparature
    plotly-logomark
    xxxxxxxxxx
    # Histogram

    Histogram¶

    xxxxxxxxxx
    A **histogram** is a graph that shows the frequency distribution of numerical data. In addition to helping us understand frequency, histograms are also useful for detecting outliers. We can use the `px.histogram()` function from Plotly to draw histograms for specific columns, as long as the data type is numerical. Let's check the following example:

    A histogram is a graph that shows the frequency distribution of numerical data. In addition to helping us understand frequency, histograms are also useful for detecting outliers. We can use the px.histogram() function from Plotly to draw histograms for specific columns, as long as the data type is numerical. Let's check the following example:

    [10]:
    xxxxxxxxxx
     
    import plotly.express as px
    ​
    df = pd.read_csv("data/mexico-city-real-estate-1.csv")
    fig = px.histogram(df, x="price")
    fig.show()
    020M40M60M80M100M120M0200400600800
    pricecount
    plotly-logomark
    xxxxxxxxxx
    <font size="+1">Practice</font> 

    Practice

    Check the "surface_covered_in_m2" Histogram.

    [11]:
    xxxxxxxxxx
     
    fig = px.histogram(df,x="surface_covered_in_m2")
    fig.show()
    01000200030004000500060007000800002004006008001000
    surface_covered_in_m2count
    plotly-logomark
    xxxxxxxxxx
    # Boxplots

    Boxplots¶

    xxxxxxxxxx
    A **boxplot** is a graph that shows the minimum, first quartile, median, third quartile, and the maximum values in a dataset. Boxplots are useful because they provide a visual summary of the data, enabling researchers to quickly identify mean values, the dispersion of the data set, and signs of skewness. In the following example, we will explore how to draw boxplots for specific columns of a DataFrame.

    A boxplot is a graph that shows the minimum, first quartile, median, third quartile, and the maximum values in a dataset. Boxplots are useful because they provide a visual summary of the data, enabling researchers to quickly identify mean values, the dispersion of the data set, and signs of skewness. In the following example, we will explore how to draw boxplots for specific columns of a DataFrame.

    [12]:
    xxxxxxxxxx
     
    # Read Data
    mexico_city1 = pd.read_csv("./data/mexico-city-real-estate-1.csv")
    ​
    # Clean the data and drop `NaNs`
    mexico_city1 = mexico_city1.drop(
        ["floor", "price_usd_per_m2", "expenses", "rooms"], axis=1
    )
    mexico_city1 = mexico_city1.dropna(axis=0)
    ​
    # Exclude some outliers
    mexico_city1 = mexico_city1[mexico_city1["price"] < 100000000]
    mexico_city1.head()
    [12]:
    operation property_type place_with_parent_names lat-lon price currency price_aprox_local_currency price_aprox_usd surface_total_in_m2 surface_covered_in_m2 price_per_m2 properati_url
    2 sell apartment |México|Distrito Federal|Cuauhtémoc| 19.41501,-99.175174 2700000.0 MXN 2748947.10 146154.51 61.0 61.0 44262.295082 http://cuauhtemoc.properati.com.mx/2pu_venta_a...
    3 sell apartment |México|Distrito Federal|Cuauhtémoc| 19.41501,-99.175174 6347000.0 MXN 6462061.92 343571.36 176.0 128.0 49585.937500 http://cuauhtemoc.properati.com.mx/2pv_venta_a...
    6 sell apartment |México|Distrito Federal|Miguel Hidalgo| 19.456564,-99.191724 670000.0 MXN 682146.11 36267.97 65.0 65.0 10307.692308 http://miguel-hidalgo-df.properati.com.mx/46h_...
    7 sell apartment |México|Distrito Federal|Gustavo A. Madero| 19.512787,-99.141393 1400000.0 MXN 1425379.97 75783.82 82.0 70.0 20000.000000 http://gustavo-a-madero.properati.com.mx/46p_v...
    8 sell house |México|Distrito Federal|Álvaro Obregón| 19.358776,-99.213557 6680000.0 MXN 6801098.67 361597.08 346.0 346.0 19306.358382 http://alvaro-obregon.properati.com.mx/46t_ven...
    xxxxxxxxxx
    Check the boxplot for column `"price"`:

    Check the boxplot for column "price":

    [13]:
    xxxxxxxxxx
     
    import plotly.express as px
    ​
    fig = px.box(mexico_city1, y="price")
    fig.show()
    020M40M60M
    price
    plotly-logomark
    xxxxxxxxxx
    If you want to check the distribution of a column value by different categories, defined by another categorical column, you can add an `x` argument to specify the name of the categorical column. In the following example, we check the price distribution across different property types:

    If you want to check the distribution of a column value by different categories, defined by another categorical column, you can add an x argument to specify the name of the categorical column. In the following example, we check the price distribution across different property types:

    [14]:
    xxxxxxxxxx
     
    fig = px.box(mexico_city1, x="property_type", y="price")
    fig.show()
    apartmenthousestore020M40M60M
    property_typeprice
    plotly-logomark
    xxxxxxxxxx
    <font size="+1">Practice</font> 

    Practice

    Check the "surface_covered_in_m2" distribution by property types.

    [15]:
    xxxxxxxxxx
     
    fig = ...
    fig.show()
    ---------------------------------------------------------------------------
    AttributeError                            Traceback (most recent call last)
    Cell In [15], line 2
          1 fig = ...
    ----> 2 fig.show()
    
    AttributeError: 'ellipsis' object has no attribute 'show'
    xxxxxxxxxx
    # Bar Chart

    Bar Chart¶

    xxxxxxxxxx
    A **bar chart** is a graph that shows all the values of a categorical variable in a dataset. They consist of an axis and a series of labeled horizontal or vertical bars. The bars depict frequencies of different values of a variable or simply the different values themselves. The numbers on the y-axis of a vertical bar chart or the x-axis of a horizontal bar chart are called the scale. 

    A bar chart is a graph that shows all the values of a categorical variable in a dataset. They consist of an axis and a series of labeled horizontal or vertical bars. The bars depict frequencies of different values of a variable or simply the different values themselves. The numbers on the y-axis of a vertical bar chart or the x-axis of a horizontal bar chart are called the scale.

    In the following example, we will see some bar plots based on the Mexico City real estate dataset. Specifically, we will count the number of observations in each borough and plot them. We first need to read the data set and extract Borough and other location information from column "place_with_parent_names".

    [ ]:
    xxxxxxxxxx
     
    # Read Data
    mexico_city1 = pd.read_csv("./data/mexico-city-real-estate-1.csv")
    ​
    # Clean the data and drop `NaNs`
    mexico_city1 = mexico_city1.drop(
        ["floor", "price_usd_per_m2", "expenses", "rooms"], axis=1
    )
    ​
    # find location columns from place_with_parent_names
    mexico_city1[
        ["First Empty", "Country", "City", "Borough", "Second Empty"]
    ] = mexico_city1["place_with_parent_names"].str.split("|", 4, expand=True)
    mexico_city1 = mexico_city1.drop(["First Empty", "Second Empty"], axis=1)
    mexico_city1 = mexico_city1.dropna(axis=0)
    ​
    # Exclude some outliers
    mexico_city1 = mexico_city1[mexico_city1["price"] < 100000000]
    mexico_city1 = mexico_city1[mexico_city1["Borough"] != ""]
    ​
    mexico_city1.head()
    xxxxxxxxxx
    We can calculate the number of real estate showing in the data set by Borough using `value_counts()`, then plot it as bar plot:

    We can calculate the number of real estate showing in the data set by Borough using value_counts(), then plot it as bar plot:

    [ ]:
    xxxxxxxxxx
     
    # Use value_counts() to get the data
    mexico_city1["Borough"].value_counts()
    [ ]:
    xxxxxxxxxx
     
    # Plot value_counts() data
    fig = px.bar(mexico_city1["Borough"].value_counts())
    fig.show()
    xxxxxxxxxx
    We can plot more expressive bar plots by adding more arguments. For example, we can plot the number of observations by borough and property type. First of all, we need use `groupby` to calculate the aggregated counts for each Borough and property type combination:

    We can plot more expressive bar plots by adding more arguments. For example, we can plot the number of observations by borough and property type. First of all, we need use groupby to calculate the aggregated counts for each Borough and property type combination:

    [ ]:
    xxxxxxxxxx
     
    size_df = mexico_city1.groupby(["Borough", "property_type"], as_index=False).size()
    size_df.head()
    xxxxxxxxxx
    By specifying `x`, `y` and `color`, the following bar graph shows the total counts by Borough, with different property types showing in different colors. Note `y` has to be numerical, while `x` and `color` are usually categorical variables.<span style='color: transparent; font-size:1%'>WQU WorldQuant University Applied Data Science Lab QQQQ</span>

    By specifying x, y and color, the following bar graph shows the total counts by Borough, with different property types showing in different colors. Note y has to be numerical, while x and color are usually categorical variables.WQU WorldQuant University Applied Data Science Lab QQQQ

    [ ]:
    xxxxxxxxxx
     
    fig = px.bar(size_df, x="Borough", y="size", color="property_type", barmode="relative")
    fig.show()
    xxxxxxxxxx
    Note the argument `barmode` is specified as 'relative', which is also the default value. In this mode, bars are stacked above each other. We can also use 'overlay' where bars are drawn on top of each other.

    Note the argument barmode is specified as 'relative', which is also the default value. In this mode, bars are stacked above each other. We can also use 'overlay' where bars are drawn on top of each other.

    [ ]:
    xxxxxxxxxx
     
    fig = px.bar(size_df, x="Borough", y="size", color="property_type", barmode="overlay")
    fig.show()
    xxxxxxxxxx
    If we want bars to be placed beside each other, we can specify `barmode` as "group":

    If we want bars to be placed beside each other, we can specify barmode as "group":

    [ ]:
    xxxxxxxxxx
     
    fig = px.bar(size_df, x="Borough", y="size", color="property_type", barmode="group")
    fig.show()
    xxxxxxxxxx
    <font size="+1">Practice</font> 

    Practice

    Plot bar plot for the number of observations by property types in "mexico-city-real-estate-1.csv".

    [ ]:
    xxxxxxxxxx
     
    bar_df = ...
    ​
    fig = ...
    fig.show()
    xxxxxxxxxx
    # References and Further Reading

    References and Further Reading¶

    • Official plotly express Documentation on Scatter Plots
    • Official plotly Express Documentation on 3D Plots
    • Official plotly Documentation on Notebooks
    • plotly Community Forum Post on Axis Labeling
    • plotly express Official Documentation on Tile Maps
    • plotly Choropleth Maps in Python Document
    • plotly express Official Documentation on Figure Display
    • Online Tutorial on String Conversion in Pandas
    • Official Pandas Documentation on using Lambda Functions on a Column
    • Official Seaborn Documentation on Generating a Heatmap
    • Online Tutorial on Correlation Matrices in Pandas
    • Official Pandas Documentation on Correlation Matrices
    • Official Matplotlib Documentation on Colormaps
    • Official Pandas Documentation on Box Plots
    • Online Tutorial on Box Plots
    • Online Tutorial on Axes Labels in Seaborn and Matplotlib
    • Matplotlib Gallery Example of an Annotated Heatmap
    xxxxxxxxxx
    ---

    Copyright 2022 WorldQuant University. This content is licensed solely for personal use. Redistribution or publication of this material is strictly prohibited.

    xxxxxxxxxx
    Advanced Tools
    xxxxxxxxxx
    xxxxxxxxxx

    -

    Variables

    Callstack

      Breakpoints

      Source

      xxxxxxxxxx
      1
      08-visualization-plotly.ipynb
      • Scatter Plots
      • 3D Scatter Plots
      • Mapbox Scatter Plots
      • Choropleth Maps
      • Histogram
      • Boxplots
      • Bar Chart
      • References and Further Reading
        0
        18
        Python 3 (ipykernel) | Idle
        Saving completed
        Uploading…
        08-visualization-plotly.ipynb
        English (United States)
        Spaces: 4
        Ln 1, Col 1
        Mode: Command
        • Console
        • Change Kernel…
        • Clear Console Cells
        • Close and Shut Down…
        • Insert Line Break
        • Interrupt Kernel
        • New Console
        • Restart Kernel…
        • Run Cell (forced)
        • Run Cell (unforced)
        • Show All Kernel Activity
        • Debugger
        • Continue
          Continue
          F9
        • Evaluate Code
          Evaluate Code
        • Next
          Next
          F10
        • Step In
          Step In
          F11
        • Step Out
          Step Out
          Shift+F11
        • Terminate
          Terminate
          Shift+F9
        • Extension Manager
        • Enable Extension Manager
        • File Operations
        • Autosave Documents
        • Open from Path…
          Open from path
        • Reload Notebook from Disk
          Reload contents from disk
        • Revert Notebook to Checkpoint
          Revert contents to previous checkpoint
        • Save Notebook
          Save and create checkpoint
          Ctrl+S
        • Save Notebook As…
          Save with new path
          Ctrl+Shift+S
        • Show Active File in File Browser
        • Trust HTML File
        • Help
        • About JupyterLab
        • Jupyter Forum
        • Jupyter Reference
        • JupyterLab FAQ
        • JupyterLab Reference
        • Launch Classic Notebook
        • Licenses
        • Markdown Reference
        • Reset Application State
        • Image Viewer
        • Flip image horizontally
          H
        • Flip image vertically
          V
        • Invert Colors
          I
        • Reset Image
          0
        • Rotate Clockwise
          ]
        • Rotate Counterclockwise
          [
        • Zoom In
          =
        • Zoom Out
          -
        • Kernel Operations
        • Shut Down All Kernels…
        • Launcher
        • New Launcher
        • Main Area
        • Activate Next Tab
          Ctrl+Shift+]
        • Activate Next Tab Bar
          Ctrl+Shift+.
        • Activate Previous Tab
          Ctrl+Shift+[
        • Activate Previous Tab Bar
          Ctrl+Shift+,
        • Activate Previously Used Tab
          Ctrl+Shift+'
        • Close All Other Tabs
        • Close All Tabs
        • Close Tab
          Alt+W
        • Close Tabs to Right
        • Find Next
          Ctrl+G
        • Find Previous
          Ctrl+Shift+G
        • Find…
          Ctrl+F
        • Log Out
          Log out of JupyterLab
        • Presentation Mode
        • Show Header Above Content
        • Show Left Sidebar
          Ctrl+B
        • Show Log Console
        • Show Right Sidebar
        • Show Status Bar
        • Shut Down
          Shut down JupyterLab
        • Simple Interface
          Ctrl+Shift+D
        • Notebook Cell Operations
        • Change to Code Cell Type
          Y
        • Change to Heading 1
          1
        • Change to Heading 2
          2
        • Change to Heading 3
          3
        • Change to Heading 4
          4
        • Change to Heading 5
          5
        • Change to Heading 6
          6
        • Change to Markdown Cell Type
          M
        • Change to Raw Cell Type
          R
        • Clear Outputs
        • Collapse All Code
        • Collapse All Outputs
        • Collapse Selected Code
        • Collapse Selected Outputs
        • Copy Cells
          C
        • Cut Cells
          X
        • Delete Cells
          D, D
        • Disable Scrolling for Outputs
        • Enable Scrolling for Outputs
        • Expand All Code
        • Expand All Outputs
        • Expand Selected Code
        • Expand Selected Outputs
        • Extend Selection Above
          Shift+K
        • Extend Selection Below
          Shift+J
        • Extend Selection to Bottom
          Shift+End
        • Extend Selection to Top
          Shift+Home
        • Insert Cell Above
          A
        • Insert Cell Below
          B
        • Merge Cell Above
          Ctrl+Backspace
        • Merge Cell Below
          Ctrl+Shift+M
        • Merge Selected Cells
          Shift+M
        • Move Cells Down
        • Move Cells Up
        • Paste Cells Above
        • Paste Cells and Replace
        • Paste Cells Below
          V
        • Redo Cell Operation
          Shift+Z
        • Run Selected Cells
          Shift+Enter
        • Run Selected Cells and Don't Advance
          Ctrl+Enter
        • Run Selected Cells and Insert Below
          Alt+Enter
        • Run Selected Text or Current Line in Console
        • Select Cell Above
          K
        • Select Cell Below
          J
        • Split Cell
          Ctrl+Shift+-
        • Undo Cell Operation
          Z
        • Notebook Operations
        • Change Kernel…
        • Clear All Outputs
        • Close and Shut Down
        • Collapse All Cells
        • Deselect All Cells
        • Enter Command Mode
          Ctrl+M
        • Enter Edit Mode
          Enter
        • Expand All Headings
        • Interrupt Kernel
        • New Console for Notebook
        • New Notebook
          Create a new notebook
        • Reconnect To Kernel
        • Render All Markdown Cells
        • Restart Kernel and Clear All Outputs…
        • Restart Kernel and Run All Cells…
        • Restart Kernel and Run up to Selected Cell…
        • Restart Kernel…
        • Run All Above Selected Cell
        • Run All Cells
        • Run Selected Cell and All Below
        • Select All Cells
          Ctrl+A
        • Toggle All Line Numbers
          Shift+L
        • Toggle Collapse Notebook Heading
          T
        • Trust Notebook
        • Settings
        • Advanced Settings Editor
          Ctrl+,
        • Show Contextual Help
        • Show Contextual Help
          Live updating code documentation from the active kernel
          Ctrl+I
        • Spell Checker
        • Choose spellchecker language
        • Toggle spellchecker
        • Terminal
        • Decrease Terminal Font Size
        • Increase Terminal Font Size
        • New Terminal
          Start a new terminal session
        • Refresh Terminal
          Refresh the current terminal session
        • Use Terminal Theme: Dark
          Set the terminal theme
        • Use Terminal Theme: Inherit
          Set the terminal theme
        • Use Terminal Theme: Light
          Set the terminal theme
        • Text Editor
        • Decrease Font Size
        • Increase Font Size
        • Indent with Tab
        • New Markdown File
          Create a new markdown file
        • New Python File
          Create a new Python file
        • New Text File
          Create a new text file
        • Spaces: 1
        • Spaces: 2
        • Spaces: 4
        • Spaces: 8
        • Theme
        • Decrease Code Font Size
        • Decrease Content Font Size
        • Decrease UI Font Size
        • Increase Code Font Size
        • Increase Content Font Size
        • Increase UI Font Size
        • Theme Scrollbars
        • Use Theme: JupyterLab Dark
        • Use Theme: JupyterLab Light